import { request } from "@/utils/service"
import type * as Case from "./types"

/** 增 */
export function createCaseApi(data: Case.CreateOrUpdateCaseRequestData) {
  return request({
    url: "case",
    method: "post",
    data
  })
}

/** 删 */
export function deleteCaseApi(id: string) {
  return request({
    url: `case/${id}`,
    method: "delete"
  })
}

/** 改 */
export function updateCaseApi(data: Case.CreateOrUpdateCaseRequestData) {
  return request({
    url: "case/" + data.id,
    method: "put",
    data
  })
}

/** 查 */
export function getCaseApi(params: Case.GetCaseRequestData) {
  return request<Case.GetCaseResponseData>({
    url: "case",
    method: "get",
    params
  })
}

/** 查详情 */
export function getCaseDetailApi(id: string) {
  return request<Case.GetCaseResponeseDetailData>({
    url: `case/${id}`,
    method: "get"
  })
}
